import {
  createRouter,
  createWebHashHistory,
  createWebHistory,
} from "vue-router";

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    component: () => import("../views/Home.vue"),
  },
  {
    path: "/news/addnews",
    component: () => import("../views/AddNews.vue"),
  },
  {
    path: "/news/newslist",
    component: () => import("../views/NewsList.vue"),
  },
  {
    path: "/:pathMatch(.*)*",
    component: () => import("../views/NotFound.vue"),
  },
];

const router = createRouter({
  //模式一：hash模式
  // history: createWebHashHistory(),
  //模式二：history模式
  history: createWebHistory(),
  routes,
});

export default router;
